#include<stdio.h>
#include<stdlib.h>

int* twoSum(int* nums,int numsize,int target,int* returnsize);

int main()
{
   int Nums[] = {2,7,11,15};
   int Target = 22;
   int* resultNums = (int*)malloc(2*sizeof(int));
   if(resultNums == NULL)
   {
        printf("内存分配失败！\n");
        return 0;
   }
   printf("sizeof(Nums) = %d\n",(int)sizeof(Nums));
   resultNums = twoSum(Nums,4,Target,resultNums);
   printf("resultNums = %d,%d;\n",resultNums[0],resultNums[1]);
   free(resultNums);
}

int* twoSum(int* nums,int numsize,int target,int* returnsize)
{
    int i,j;
    for(i = 0;i < numsize - 1;i++)
    {
        for(j = i+1;j < numsize; j++)
        {
            if(nums[i]+nums[j] == target )
            {
                returnsize[0] = i;
                returnsize[1] = j;
                return returnsize;
            }
            printf("i = %d,j = %d\n",i,j);
        }
        
    }
    *returnsize++ = 0;
    *returnsize = 0;
    return returnsize--;

}